function Tabs_getSelectedIndex(id) {
	var tabs = document.getElementById(id);
	if (tabs != null) {
		var selIndex = tabs.getAttribute("selIndex");
		if (selIndex == null) {
			tabs.setAttribute("selIndex", -1);
			selIndex = -1;
		}
		return parseInt(selIndex);
	} else {
		return -1;
	}
}

function Tabs_setSelectedIndex(id, index) {
	var tabs = document.getElementById(id);
	if (tabs != null) {
		var oldIndex = Tabs_getSelectedIndex(id);
		tabs.setAttribute("selIndex", index);
		var newClassName = id + getPostfixForState(getElementState(tabs)) + "_" + index;
		if (tabs.className != newClassName) {
			tabs.className = newClassName;
		}
		var tabCount = parseInt(tabs.getAttribute("tabCount"));
		for (i = 0; i < tabCount; i ++) {
			if (i == index - 1) {
				changeVisibility(id + "_#" + i, 1, false);
			} else {
				changeVisibility(id + "_#" + i, 0, false);
			}
		}
		if (oldIndex != index) {
			try {
				eval(id + "_onSelectionChanged(" + index + ");");
			} catch (err) {}
		}
	}
}
